import Vue from 'vue'
import VueRouter from 'vue-router'

import Public from '@/views/Public.vue'

// 公共部分
import HomePage from '@/views/Home/HomePage.vue'
import FoundHouse from '@/views/FoundHouse.vue'
import Information from '@/views/Information.vue'
import User from '@/views/User.vue'

// 首页的孩子
import GoHouse from '@/views/Home/main/goHouse.vue'
import HeZu from '@/views/Home/main/hezu.vue'
import Main from '@/views/Home/main/main.vue'
import MapFound from '@/views/Home/main/mapFound.vue'
import Adress from '@/views/Home/header/adress.vue'

// 找房
const Map = () => import('@/views/foundhouse/header/map.vue')

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    component: Public,
    redirect: '/homepage',
    children: [
      {
        path: '/homepage',
        component: HomePage
      },
      { path: '/foundhouse', component: FoundHouse },
      { path: '/information', component: Information },
      { path: '/user', component: User },
      { path: '/gohouse', component: GoHouse },
      { path: '/hezu', component: HeZu },
      { path: '/main', component: Main },
      { path: '/mapfound', component: MapFound }
    ]
  },
  { path: '/adress', component: Adress },
  { path: '/map', component: Map }
]

const router = new VueRouter({
  routes
})

export default router
